home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 183_01 / lotto.c < prev    next >
Encoding:
Text File  |  1985-08-30  |  640 b   |  35 lines

  1. /*
  2.     lotto.c
  3.         print batches of six numbers for lottery betting.
  4.  
  5. 8/29/84    rjf    created.
  6.  
  7. */
  8. main(argc,argv)
  9. int argc;
  10. char argv[];
  11. {
  12.  
  13.     double drand48();
  14.     int z,x,ay[44];
  15.     
  16.     for(;;) {
  17.         for (z=0;z<45;++z)
  18.             ay[z] = 0;
  19.             for (z=1;z<7;++z) {
  20.              do {
  21.                 x = (int)(drand48()*44)+1;
  22.                }
  23.             while (ay[x] == 1) ;
  24.             ay[x] = 1;            
  25.             printf("%2d\t",x);
  26.         }
  27.         printf("\n");
  28.     }
  29. }
  30.  
  31. ntf("\n");
  32.     }
  33. }
  34.